|
|
|
|
|
|
|
properties for compatibility, but you should avoid them. If you have to set the font for two text boxes, for example, you can set one directly from the CommonDialog control's properties and the other one simply by assigning the first text box's Font property: |
|
|
|
|
|
|
|
|
Set txtAddress.Font = txtName.Font |
|
|
|
|
|
|
|
|
Figure 7.7 shows the Font dialog box that is presented to the user. This particular dialog box contains both screen and printer fonts. |
|
|
|
|
|
|
|
|
Figure 7.7
The Font dialog box can be programmed
to display screen fonts, printer fonts, or both. |
|
|
|
|
|
|
|
|
Table 7.4 shows the control's properties and the font attributes that each manipulates. |
|
|
|
|
| Table 7.4 CommonDialog Control Properties That Store Font Attributes | | Property | Attribute | | FontName | The name of the base font | | FontSize | The height of the font in points | | FontBold | Whether boldface is selected | | FontItalic | Whether italic is selected | | FontUnderline | Whether the font is underlined | | FontStrikethru | Whether the font has a line through it |
|
|
|
|
|
|
The font information can be used to set the font of any object in your program or even to set the font for the Printer object. Be sure to peruse the Help system for a complete list of Flags property constants. |
|
|
|
|
|
|
|
|
The CommonDialog control's Color dialog box lets the user select colors that can be used for the foreground or background colors of your forms or controls (see Figure 7.8). The user has the option of choosing one of the standard colors, or creating and selecting a custom color. |
|
|
|
|
|